import { Controller, Post as HttpPost, Get, Param, Req, UseGuards } from '@nestjs/common';
import { ApiOperation } from '@nestjs/swagger';
import { UserLikeService } from './user-like.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';

@Controller('like')

export class UserLikeController {
  constructor(private readonly likeService: UserLikeService) {}

  @ApiOperation({ summary: '对某个帖子点赞' })
  @HttpPost(':postId')
  async likePost(@Param('postId') postId: number, @Req() req) {
    return this.likeService.like(postId, req.user.id);
  }

  @ApiOperation({ summary: '获取用户点赞的帖子' })
  @Get('my')
  async getLikedPosts(@Req() req) {
    return this.likeService.getLikedPosts(req.user.id);
  }
}
